﻿using System;
using System.Collections.Generic;
using UnityEngine;

public class WinChecker : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
         var player = other.GetComponent<Player>();
         if (player && !player.achieved && !player.dead)
         {
             GameDebug.LogError($"player achieved!");
             if (player.mBattleController.sceneType == MBattleController.SceneType.EduScene)
             {
                 if (player.score >= 60)
                 {
                     player.OnWinPrepare();
                     if(player.eduWinObj)
                        player.eduWinObj.SetActive(true);
                 }
                 else
                 {
                     player.ReceiveDeadlyDamage();
                 }
             }
             else
             {
                 player.OnWinPrepare();

             }
         }

    }

}